﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using FilStartUps.DAL;

namespace FilStartUps.Forum
{
    public partial class Report : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void btnsubmitreport_Click(object sender, EventArgs e)
        {
            using (FilStartUpsEntities db_connect = new FilStartUpsEntities())
            {
                ForumReport forumreport = new ForumReport();
                var user = db_connect.Members.Where(m => m.emailaddress.Equals(User.Identity.Name)).SingleOrDefault();
                forumreport.datereport = DateTime.Now;
                forumreport.forummsgidFK = Convert.ToInt32(Request.QueryString["t"].Trim());
                forumreport.memberidFK = user.memberidPK;
                forumreport.reportmessage = txtreport.Text.Trim();
                db_connect.ForumReports.Add(forumreport);
                db_connect.SaveChanges();
                //NOTIFICATION
            }
        }

    
    }
}